<#if !basePath??><#assign basePath=request.contextPath ></#if>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>NEBULA-UPMS综合管理平台</title>
	<#include "${basePath}/comm/meta-base.ftl" />
	<#include "${basePath}/comm/meta-custom.ftl" />
	<#include "${basePath}/comm/meta-comm.ftl" />
	<script src="${Application.STATIC_SERVER}/project/erp-static/js/beyond.js"></script>
	<script src="${Application.STATIC_SERVER}/project/erp-static/js/index.js"></script>
</head>
<!-- /Head -->
<!-- Body -->
<body id="framework_body">
    <!-- 导航栏 -->
    <div class="navbar">
		<div  class="navbar-inner" style="background:${currentAppSystemVO.color}" >
            <div class="navbar-container">
                <!-- 导航菜单 -->
                <div class="navbar-header pull-left">
                    <a href="#" class="navbar-brand">
                        <small><img src="${Application.STATIC_SERVER}/project/erp-static/img/logo.png" alt="" /></small>
                    </a>
                </div>
                <!-- /导航菜单 -->
                
                <!-- 侧边菜单收缩 -->
                <div class="sidebar-collapse" id="sidebar-collapse">
                    <i class="collapse-icon fa fa-bars"></i>
                </div>
                <!-- /侧边菜单收缩 -->
                
                <!-- 当前系统 -->
                <div class="current-system">
                	<i class="fa ${currentAppSystemVO.icon} write"></i><span id="sysname">${currentAppSystemVO.name}</span>
                </div>
                <div style="position:absolute;left:500px;top:6px;width:200px;">
                	<#if environment!='prod' ><span style="color:#FFB5C5;font-size:22px;font-weight:bold">(${systemName})</span></#if>
                </div>
                
                
                <!-- /当前系统 -->
                
                <!-- 账户区和设置 --->
                <div class="navbar-header pull-right">
                    <div class="navbar-account">
                        <ul class="account-area">
                        	<li class="msgli">
                        		<a class="dropdown-toggle " data-toggle="dropdown" title="系统公告" href="#">
			                   		<i class="icon fa fa-envelope"></i><span class="msgtext "></span>
			                	</a>
                                <!--Messages Dropdown-->
                                <ul class="pull-right dropdown-menu dropdown-arrow dropdown-messages">
                                   <span  id="messageDiv"></span>
                                   
                                   <li style="text-align:right"><a style="color:#0072c6" 
                                   href="javascript:MainTab.createTab('mess','公告列表','${basePath}/message/message-staff-main')"  >更多公告&gt;&gt;</a></li>
                                </ul>
                                <!--/Messages Dropdown-->
                            </li>
                        
                        
                        
                            <li>
                                <a class=" dropdown-toggle" data-toggle="dropdown" title="系统切换" href="#">
                                    <i class="icon fa fa-th-large"></i>
                                </a>
                                <!--系统切换列表-->
                                <div class="pull-right dropdown-system-area dropdown-menu dropdown-arrow ">
                                    <div class="stitle">
                                    	<i class="fa  fa-refresh margin-right-10"></i>系统切换
                                    </div>
                                    <#list upmsUserVO.upmsAppSystemVOList as upmsAppSystemVO>
	                                    <a id="swc_${upmsAppSystemVO.appSystemId}" class="sitem <#if upmsAppSystemVO.appSystemId==currentAppSystemVO.appSystemId>active</#if> " 
	                                    href="javascript:void(0)"  onClick="switchSystem('${upmsAppSystemVO.appSystemId}','${upmsAppSystemVO.name}','${upmsAppSystemVO.color}')">
	                                        <i class="fa ${upmsAppSystemVO.icon}" style="color:${upmsAppSystemVO.color}" ></i>${upmsAppSystemVO.name}
	                                    </a>
                                    </#list>
                                </div>
                                <!--/系统切换列表-->
                            </li>
                            
                            
                            
                           
                            <li>
                                <a class="login-area dropdown-toggle" data-toggle="dropdown">
                                    <div class="avatar" title="">
                                        <img src="${Application.STATIC_SERVER}/project/erp-static/img/user.png">
                                    </div>
                                    <section>
                                        <h2><span class="profile"><span>${upmsUserVO.departmentName}-${upmsUserVO.personName}</span></span></h2>
                                    </section>
                                </a>
                                <!--登录区 下拉-->
                                <ul class="pull-right dropdown-menu dropdown-arrow dropdown-login-area">
                                    <li class="edit">
                                        <a href="javascript:resetPassword()" class="pull-left">修改密码</a>
                                        <a href="#" class="pull-right"></a>
                                    </li>
                                    <li class="dropdown-footer">
                                        <a href="${basePath}/exit"> 退出系统</a>
                                    </li>
                                </ul>
                                <!--/登录区 下拉-->
                            </li>
                            <!-- /账户区 -->
                        </ul>
                    </div>
                </div>
                <!-- /账户区和设置 -->
            </div>
        </div>
    </div>
    <!-- /导航栏 -->
    
    <!-- 主区域 -->
    <div class="main-container container-fluid">
        <!-- 页面区域 -->
        <div class="page-container">

            <!-- 页面侧边栏 -->
            <div class="page-sidebar" id="sidebar">
                <!-- 侧边栏头
                <div class="sidebar-header-wrapper">
                    <input type="text" class="searchinput" />
                    <i class="searchicon fa fa-search"></i>
                    <div class="searchhelper">Search Reports, Charts, Emails or Notifications</div>
                </div>
                -->
                <!-- /侧边栏头 -->
                <!-- 侧边栏菜单 -->
                <ul class="nav sidebar-menu">
                	<#list upmsUserVO.upmsAppSystemVOList as appSystemVO>
                		<#list appSystemVO.upmsPrivilegeVOFolderList as privilegeVOFolder>
                		
                			<#if privilegeVOFolder.upmsPrivilegeVOMenuList?size==0>
                			<li class="sys_${appSystemVO.appSystemId}">
		                        <a href="javascript:openMenu('${privilegeVOFolder.privilegeId}','${privilegeVOFolder.name}','${privilegeVOFolder.appServerName}/${privilegeVOFolder.programCode}')">
		                        	<i class="menu-icon fa ${privilegeVOFolder.icon}"></i><span class="menu-text">${privilegeVOFolder.name}</span></a>
		                    </li>
		                    <#else>
	                		<li class="sys_${appSystemVO.appSystemId} <#if privilegeVOFolder_index==0 >open</#if>  <#if appSystemVO.appSystemId!=currentAppSystemVO.appSystemId>hidden</#if> ">
		                        <a href="#" class="menu-dropdown">
		                            <i class="menu-icon fa ${privilegeVOFolder.icon}"></i>
		                            <span class="menu-text">${privilegeVOFolder.name}</span>
		                            <i class="menu-expand"></i>
		                        </a>
		                        <ul class="submenu">
		                        	<#list privilegeVOFolder.upmsPrivilegeVOMenuList as privilegeVOMenu>
		                        	<li id="menu_${privilegeVOMenu.privilegeId}">
		                        		<a href="javascript:openMenu('${privilegeVOMenu.privilegeId}','${privilegeVOMenu.name}','/${privilegeVOMenu.appServerName}/${privilegeVOMenu.programCode}')">
		                            	<i class="menu-icon fa ${privilegeVOMenu.icon}"></i>
		                            	<span class="menu-text">${privilegeVOMenu.name}</span></a></li>
		                            </#list>
		                        </ul>
		                    </li>
		                    </#if>
		                    
                		</#list>
                	</#list>
                	
                    <li class="static">
                        <a href="#">
                            <i class="menu-icon glyphicon glyphicon-fire themesecondary"></i>
                            <span class="menu-text">系统版本信息 V1.0
                            </span>
                        </a>
                    </li>
                </ul>
                <!-- /侧边栏菜单 -->
                
            </div>
            <!-- /页面内容 -->
            <!-- Page Content -->
            <div class="page-content">            
             	<!--tab Demo-->
                <div id="main-tabs">
                    <ul>
                        <li id="li_home"><a href="#ifm_home">首页</a></li>
                        <!--Header Buttons-->
                        <div class="tabs-buttons">
                        	<a class="sidebar-expand" href="javascript:maxminTab()">
                                <i class="fa fa-expand"></i>
                            </a>
                            <a class="sidebar-toggler" href="#">
                                <i class="fa fa-arrows-h"></i>
                            </a>
                            <a class="refresh"  href="javascript:refreshTabPage()">
                                <i class="glyphicon glyphicon-refresh"></i>
                            </a>
                            <a class="fullscreen" id="fullscreen-toggler" href="#">
                                <i class="glyphicon glyphicon-fullscreen"></i>
                            </a>
                        </div>
                        <!--Header Buttons End-->

                    </ul>
                    <div class="tab-iframe-div " id="ifm_home">
                    	<iframe class="tab-iframe " src="${basePath}/home" width="100%"  frameborder="no" 
                        border="0" marginwidth="0" marginheight="0" scrolling="yes" allowtransparency="yes" ></iframe>
                    </div>
                </div>
                <!-- /tab End demo -->
            
            </div>
            <!-- /Page Content -->

            

        </div>
        <!-- /页面区域 -->
        <!-- /主区域 -->
        
    </div>
    
    <!-- 右键菜单 -->
    <div id="tab_rightmenu" class="dropdown-container hidden" style="position:absolute; z-index:999">
        <div class="dropdown-preview">
            <ul class="dropdown-menu">
                
                <li><a href="javascript:menuCloseTab('this')" tabindex="-1">关闭</a></li>
                
                <li><a href="javascript:menuCloseTab('all')" tabindex="-1">关闭全部</a></li>
                <li><a href="javascript:menuCloseTab('other')" tabindex="-1">关闭其他</a></li>
    
                <li class="divider"></li>
    
                <li><a href="javascript:menuCloseTab('left')" tabindex="-1">关闭左侧标签页</a></li>
                <li><a href="javascript:menuCloseTab('right')" tabindex="-1">关闭右侧标签页</a></li>
            </ul>
        </div>
    </div>
	<!-- /右键菜单 -->
   
</body>
</html>
<style>
.navbar .navbar-inner .navbar-header .navbar-account .account-area .login-area .avatar{
	border-left:0px;
}
</style>

<script>

$(document).ready(function() { 
	isAlive();
	findMessage();
}); 
window.setInterval(function(){ 
	isAlive(); 
	findMessage();
	
},1000*60*5);

function isAlive(){
	var url="${basePath}/heartbeat";
	$.ajax({
	　　url:url,
	　　timeout : 2000,
	　　type : 'get',
	　　data :{},
	　　dataType:'json',
	　　success:function(data){
	　　		if(data!='success'){
				window.location.href="${basePath}/login?error=timeout";
			}
	　　},
	　　complete : function(XMLHttpRequest,status){
	　　　　if(status=='timeout'){
	 　　　　	console.log('heartbeat time out , is server shutdown?');
	　　　　}
	   }
	});
}
function findMessage(){
	var url="${basePath}/message/staff-unread-message";
	$.ajax({
	　　url:url,
	　　timeout : 2000,
	　　type : 'get',
	　　data :{},
	　　dataType:'json',
	　　success:function(data){
			var htm="";
			for(var i=0;i<data.rows.length;i++){
				var index=i+1;
				htm+="<li><a href=\"javascript:showMessage('"+data.rows[i].messageId+"','"+data.rows[i].title+"')\">";
                    htm+="<div class=\"message\">";
                        htm+="<span class=\"message-subject\"> "+index+"."+data.rows[i].title+" </span>";
                        htm+="<span class=\"message-body\"> "+data.rows[i].subhead+" </span>";
                    htm+="</div>";
            	htm+="</a></li>";
			}
			$("#messageDiv").html(htm);　
			
			
			if(data.total>0){
				$(".msgli .dropdown-toggle").addClass("wave");
				$(".msgli .dropdown-toggle").addClass("in");
				$(".msgli .dropdown-toggle").addClass("open");
				$(".msgli .msgtext").addClass("badge");
				$(".msgli .msgtext").text(data.total);
			}else{
				$(".msgli .dropdown-toggle").removeClass("wave");
				$(".msgli .dropdown-toggle").removeClass("in");
				$(".msgli .dropdown-toggle").removeClass("open");
				$(".msgli .msgtext").removeClass("badge");
				$(".msgli .msgtext").text("");
			}
	　　}
	});
}

function showMessage(messageId,title){
	var murl="${basePath}/message/message-staff-read/"+messageId;
	$.post(murl,{},function(data){
		findMessage();
		var url="${basePath}/message/message-show/"+messageId;
		MainTab.createTab(messageId,"公告:"+title,url);
	});


	
	
}







<#if environment!='prod' >
	var str="<span style=\"color:red;font-size:22px;font-weight:bold\">您当前访问的系统是：${systemName}！</span>"
	bootbox.confirm(str, function (result) {
		if (result) {
			
		}
	});
</#if>

function resetPassword(){
	url="${basePath}/staff/staff-reset-password";
	winName="修改密码";
	//openWindow(winName,url,900,600,true);
	openMenu('rpwd','修改密码',url);

}
</script>

